package com.neu.flashmall.order.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.neu.flashmall.order.entity.OmsOrderItem;
import com.neu.flashmall.order.mapper.OmsOrderItemMapper;
import com.neu.flashmall.order.service.OmsOrderItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OmsOrderItemServiceImpl implements OmsOrderItemService {
    @Resource
    private OmsOrderItemMapper omsOrderItemMapper;

    @Override
    public PageInfo<OmsOrderItem> getPaged(Integer pageNum, Integer pageSize, Long orderId) {
        PageHelper.startPage(pageNum,pageSize);
        List<OmsOrderItem> omsOrderItems = omsOrderItemMapper.selectAll(orderId);

        PageInfo<OmsOrderItem> pageInfo = new PageInfo<>(omsOrderItems);
        return pageInfo;
    }

    @Override
    public List<OmsOrderItem> selectAll(Long orderId) {
        return omsOrderItemMapper.selectAll(orderId);
    }
}
